<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者，助力中小企业发展 
+----------------------------------------------------------------------
| Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
+----------------------------------------------------------------------
| 沃德代驾系统并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
+----------------------------------------------------------------------
| 组件-发票订单 开发者: 麦沃德科技-半夏 
+---------------------------------------------------------------------- -->

<template>
	<view class="component-order-invoice" :style="{'--theme-color': themeColor}">
		<view class="invoice-order" :class="{active: item.selected}" v-for="(item, index) in showData" :key="item.id" @click="changeSelect(index)">
			<order-item :key="item.id" :show-data="item" :loading="loading"></order-item>
			<view class="order-select" v-if="item.selected">
				<image class="select-icon" src="/static/tick.png" mode="aspectFit"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex"
	import orderItem from "@/pages/passenger/component/order/item.vue"
	export default {
		name: "componentOrderInvoice",
		props: ["showData", "loading"],
		components: {
			orderItem,
		},
		computed: {
			...mapState({
				themeColor: state => state.app.themeColor,
			})
		},
		methods: {
			// 选择商品
			changeSelect(index) {
				this.$emit("changeSelect", index)
			},
		}
	}
</script>

<style lang="scss">
	.component-order-invoice {
		.invoice-order {
			position: relative;
			margin-top: 32rpx;
			border-radius: 32rpx;
			background: #FFF;
			padding: 32rpx;
			border: 1px solid #FFF;
			overflow: hidden;

			&:first-child {
				margin-top: 0;
			}

			.order-header {
				margin-left: 16rpx;

				.header-label {
					position: relative;
					z-index: 1;
					padding: 0 4rpx;
					border-radius: 8rpx;
					overflow: hidden;
					height: 40rpx;
					line-height: 40rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					.background {
						background: var(--label-color);
						opacity: .1;
						position: absolute;
						top: 0;
						left: 0;
						right: 0;
						bottom: 0;
						z-index: -1;
					}

					.text {
						color: var(--label-color);
						text-align: center;
						font-size: 24rpx;
						font-weight: 600;
					}
				}
			}

			.order-footer {
				.footer-btn {
					color: var(--theme-color);
					font-size: 24rpx;
					font-weight: 600;
					line-height: 34rpx;
					border-radius: 24rpx;
					border: 1px solid var(--theme-color);
					height: 48rpx;
					padding: 0 16rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					margin-left: 16rpx;
				}
			}

			.order-select {
				position: absolute;
				right: 0;
				bottom: 0;
				z-index: 19;
				background: var(--theme-color);
				width: 48rpx;
				height: 48rpx;
				border-top-left-radius: 26rpx;
				padding: 2rpx;

				.select-icon {
					width: 100%;
					height: 100%;
				}
			}

			&.active {
				border-color: var(--theme-color);
			}
		}
	}
</style>